Java Database Programming with JDBC Java Database Programming with JDBC
by Pratik Patel
Coriolis, The Coriolis Group
ISBN: 1576100561   Pub Date: 10/01/96
  

Previous Table of Contents Next


Methods

Method Name Additional Description
public Numeric add(Numeric n) Performs arithmetic addition on the reference Numeric object and the Numeric argument
public static Numeric createFromByteArray(byte byteArray[]) Produces a Numeric object from the byte array parameter
public static Numeric createFromIntegerArray(int intArray[]) Produces a Numeric object from the int array parameter
public static Numeric createFromRadixString(String str, int radix) Produces a Numeric object from the String and int radix parameters
public static Numeric createFromScaled(long longNum, int power) Produces a Numeric object by taking the longNum to the 10^power
public Numeric divide(Numeric q) Divides the Numeric by the Numeric parameter q and returns the result
public double doubleValue() Returns the Numeric as a Java type double
public boolean equals(Object objct) Returns true if the Numeric object equals the objct parameter
public float floatValue() Returns the Numeric as a Java type float
public static int getRoundingValue() Returns the roundingValue used in rounding operations in the Numeric object
public int getScale() Returns the number of places to the right of the decimal
public long getScaled() Returns the Numeric object as a long, but removes the decimal (1234.567 -> 1234567); precision may be lost
public boolean greaterThan(Numeric num) Returns true if the Numeric object is greater than the Numeric num argument
public boolean greaterThanOrEquals(Numeric num) Returns true if the Numeric object is greater than or equal to the Numeric num argument
public int hashCode() Returns an integer hashcode for the Numeric object
public Numeric[] integerDivide(Numeric x) Returns an array with two Numeric objects: the first one is the quotient, the second is the remainder
public int intValue() Returns the Numeric as a Java type int, digits after the decimal are dropped
public boolean isProbablePrime() Returns true if the number is prime; it divides the Numeric object by several small primes, and then uses the Rabin probabilistic primality test to test if the number is prime—the failure rate is less than (1/(4^N))
public boolean lessThan(Numeric num) Returns true if the Numeric object is less than the Numeric num argument
public boolean lessThanOrEquals(Numeric num) Returns true if the Numeric object is less than or equal to the Numeric num argument
public long longValue() Returns the Numeric as a Java type long
public Numeric modExp (Numeric numExp, Numeric numMod) The two parameters are used to do a numMod modulus to the numExp exponent calculation; returns the result as a Numeric
public Numeric modInverse(Numeric numMod) The modular multiplicative inverse is returned using numMod as the modulus
public Numeric multiply(Numeric num) Returns the product of the Numeric object and the Numeric num parameter
public static Numeric pi(int places) Returns pi to the number of decimal places
public Numeric pow(int exp) Returns a Numeric object using the current Numeric object taken to the power of the given exponent exp
public static Numeric random(int bits, Random randSeed) Returns a Numeric object that is a random number using randSeed as a seed, having size in bits equal to the bits parameter
public Numeric remainder(Numeric num) Returns the remainder resulting from dividing this Numeric object by the Numeric num parameter
public static void setRoundingValue(int val) Sets the rounding value used in rounding operations for the Numeric object
public Numeric setScale(int scale) Returns a Numeric object from the current object with the specified scale parameter
public Numeric shiftLeft(int numberOfBits) Returns the Numeric object with the specified numberOfBits shifted left
public Numeric shiftRight(int numberOfBits) Returns the Numeric object with the specified numberOfBits shifted right
public int significantBits() Returns the number of significant bits in the Numeric object
public Numeric sqrt() Returns the square root of this Numeric object
public Numeric subtract(Numeric num) Returns the difference between the Numeric object and the Numeric num parameter
public String toString() Returns a String type that is the String representation of the Numeric object
public String toString(int radix) Returns a String type that is the String representation of the Numeric object, in the specified radix

Variables

Variable Name Additional Description
public final static Numeric ZERO A Numeric equivalent to the value of 0
public final static Numeric ONE A Numeric equivalent to the value of 1

public class Time

The public class Time is another SQL-JDBC data coversion class. This class extends java.util.Date, and basically implements the time-storing functions that are not present in the java.sql.Date class shown earlier.

Constructors

Constructor Additional Description
public Time(int hour, int minute,
int second)
Makes a Time object with the specified hour, minute, and second

Methods

Method Name Additional Description
public String toString() Returns a String with the Time formatted this way: HH:MM:SS
public static Time valueOf(String numStr) Returns a Numeric object from the String numStr parameter that is in the format: HH:MM:SS


Previous Table of Contents Next